/**
 * url字符串转成数组
 * source  /abcd/efg
 * target ['/abcd'. 'efg']
 */
const urlTransfer = (str) => {
  // 类型断言
  if (typeof str !== 'string') return []
  // 正则匹配替换头部/
  let arr = str.replace(/^\//ig, '').split('/')
  arr[0] = '/' + arr[0]
  return arr
}

export {
  urlTransfer
}